﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Lucene.Net.Index;
using Lucene.Net.Store;
using Lucene.Net.Search;
using Lucene.Net.QueryParsers;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using V5_LuceneLibs;

namespace V5_读取索引库 {
    public partial class frmMain : Form {
        public frmMain() {
            InitializeComponent();
        }

        private void btnStartRead_Click(object sender, EventArgs e) {

            this.txtLogView.Clear();

            string IndexPath = this.txtDataPath.Text;
            int Count = 0;
            VLuceneHelper.IndexPath = IndexPath;
            VLuceneHelper.Analyzer = VAnalyzerHelper.Standard;
            var list = VLuceneHelper.SearchDoc(this.txtKeyWord.Text, 20, ref Count);

            this.textBox1.Text = Count.ToString();

            foreach (var item in list) {
                this.txtLogView.AppendText(item.Content + "\r\n" + "\r\n");
            }
        }
    }
}
